package com.edais.actions;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.edais.service.FinancePlanOpfService;
import com.edais.util.CommonUtil;
import com.edais.util.Consts;
import com.edais.util.Message;

@Controller
@RequestMapping("/condition")

public class FinancePlanOpfAction  implements Serializable{
	private static final Log logger = LogFactory.getLog(FinancePlanOpfAction.class);

	@Autowired
	private FinancePlanOpfService financeService;
	
	/**
	 * E400033 设置已购买订单的筛选条件
	 * 
	 * @param request
	 * @return response
	 * @throws Exception
	 */
	@RequestMapping(value = "/getMobileProductList")
	public void getFinanceList(HttpServletRequest request, HttpServletResponse response){
		
		try{
			//获得产品列表
			List<Map> financeList = financeService.getFinanceList();
			
			//String financeIdString = financeService.getFinanceString();
			
			Map<String, Object> mapResult = new HashMap<String, Object>();
			//mapResult.put("financeIdString", financeIdString);
			mapResult.put("listSize", String.valueOf(financeList.size()));
			mapResult.put("list", financeList);
			
			mapResult.put("resmsg_cn", "");
			String result = CommonUtil.setResultInfo(mapResult, Consts.SUCCESS_CODE, Consts.SUCCESS_DESCRIBE);
			// 处理返回结果
			CommonUtil.responseJson(result, response);
			
		}catch(Exception e){
			logger.debug("/finance/getMobileProductList异常-----" + e.getMessage());
			
			String result = CommonUtil.setResultStringCn(new HashMap<String, Object>()
					,Consts.ERROR_CODE,
					Consts.ErrorMsg.MSG00001,Message.CnDescriptionExpression.BUSINESSE_ERROR);
			
			// 处理返回结果
			CommonUtil.responseJson(result, response);
		}
		return;
	}
}
